Revert "Fix: content provide throws an error when moving traces on seahawk" This reverts commit 290af73fc5709667e65650cf6e81df05e9c94c03. Reason for revert: Using a content provider to move the trace file doesn't seem like a good solution after all, since there's no simple way to ensure it's installed before the test starts. So revert the content provider changes and store the traces in a non user-specific location instead. Bug: 382321446 Merged-In: I36a7c9f7a45aa89767e85c56f2e8db66ca718550 Change-Id: I36a7c9f7a45aa89767e85c56f2e8db66ca718550
diff --git a/libraries/collectors-helper/perfetto/src/com/android/helpers/PerfettoHelper.java b/libraries/collectors-helper/perfetto/src/com/android/helpers/PerfettoHelper.java index 90ca854..c198560 100644 --- a/libraries/collectors-helper/perfetto/src/com/android/helpers/PerfettoHelper.java +++ b/libraries/collectors-helper/perfetto/src/com/android/helpers/PerfettoHelper.java
@@ -88,7 +88,6 @@ private boolean mTrackPerfettoPidFlag; private String mTrackPerfettoRootDir = "sdcard/"; private File mPerfettoPidFile; - private boolean mShouldUseContentProvider; /** Set content of the perfetto configuration to be used when tracing */ public PerfettoHelper setTextProtoConfig(String value) { @@ -497,16 +496,10 @@ // destinationFile. try { int userId = getCurrentUserId(); + // For user 0, move the file directly since the content provider is not installed (see // aosp/3284729). - boolean useContentProvider = userId != 0 && mShouldUseContentProvider; - Log.v( - LOG_TAG, - String.format( - "Going to use content provider to move temp perfetto file: %b. User id:" - + " %d and mShouldUseContentProvider: %b", - useContentProvider, userId, mShouldUseContentProvider)); - if (!useContentProvider) { + if (userId == 0) { String moveResult = mUIDevice.executeShellCommand( String.format(MOVE_CMD, PERFETTO_TMP_OUTPUT_FILE, destinationFile)); @@ -616,8 +609,4 @@ public String getPerfettoFilePrefix() { return PERFETTO_PID_FILE_PREFIX; } - - public void setShouldUseContentProvider(boolean shouldUseContentProvider) { - mShouldUseContentProvider = shouldUseContentProvider; - } } diff --git a/libraries/device-collectors/src/main/java/android/device/collectors/PerfettoTracingStrategy.java b/libraries/device-collectors/src/main/java/android/device/collectors/PerfettoTracingStrategy.java index 00e11e6..06d4fb9 100644 --- a/libraries/device-collectors/src/main/java/android/device/collectors/PerfettoTracingStrategy.java +++ b/libraries/device-collectors/src/main/java/android/device/collectors/PerfettoTracingStrategy.java
@@ -98,8 +98,6 @@ // For USB disconnected cases you may want this option to be true. This option makes sure // the device does not go to sleep while collecting. public static final String PERFETTO_START_BG_WAIT = "perfetto_start_bg_wait"; - // Argument to indicate whenever to move the temp trace using tf contend provider. - public static final String SHOULD_USE_CONTENT_PROVIDER = "perfetto_should_use_content_provider"; @VisibleForTesting static final String HOLD_WAKELOCK_WHILE_COLLECTING = "hold_wakelock_while_collecting"; @@ -461,11 +459,6 @@ // By default, this flag is set to false to collect the metrics on test failure. mSkipTestFailureMetrics = "true".equals(args.getString(SKIP_TEST_FAILURE_METRICS)); mSkipTestSuccessMetrics = "true".equals(args.getString(SKIP_TEST_SUCCESS_METRICS)); - - // By default, use content provider to move the trace file. - boolean shouldUseContentProvider = - Boolean.parseBoolean(args.getString(SHOULD_USE_CONTENT_PROVIDER, "true")); - mPerfettoHelper.setShouldUseContentProvider(shouldUseContentProvider); } /**